package com.iraeta.dao.iraorder;

import com.iraeta.entity.Iraorderscstepproduct;
import com.iraeta.entity.vo.IraOrderProductStepCount;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface IraorderscstepproductDao {
    int insert(Iraorderscstepproduct record);
    int updateByPrimaryKey(Iraorderscstepproduct record);
    int deleteByPrimaryKey(Integer id);
    Iraorderscstepproduct selectByPrimaryKey(Integer id);
    Iraorderscstepproduct selectByPS(@Param("productId") Integer productId, @Param("stepId") Integer stepId);
    /*
        根据产品id 获取每个产品在每个步骤的数量， iraorderscstepproduct不填写时 有可能为null
        select p.*,s.id as stepId, s.stepName,s.sortId,ps.stepCount from iraorderproduct p join iraorderscstep s on p.orderId=s.orderId
        left join iraorderscstepproduct ps on ps.IraOrderScStepId=s.id and ps.productId=p.Id
        where p.orderId=1 order by p.id,s.sortId
    */
    List<IraOrderProductStepCount> selectProductStepCount(@Param("productId") Integer productId);
}